/**
 * <pre>
 * Copyright (c) 2017 阿信sxq(songxinqiang@vip.qq.com).
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * </pre>
 */
/*
 * 创建时间：2017年5月30日--下午1:44:48
 * 作者：宋信强(阿信sxq, songxinqiang@vip.qq.com, https://my.oschina.net/songxinqiang)
 * <p>
 * 众里寻她千百度, 蓦然回首, 那人却在灯火阑珊处.
 * </p>
 */
package cn.songxinqiang.example.poi;

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import cn.songxinqiang.example.poi.model.User;
import cn.songxinqiang.example.poi.service.PoiXlsService;
import cn.songxinqiang.example.poi.service.PoiXlsxService;

/**
 * 展示启动入口
 *
 * @author 阿信sxq
 *
 */
public class EnterClass {

    public static void main(String[] args) {
        List<User> userList = new ArrayList<>();
        userList.add(new User(1, "test1"));
        userList.add(new User(2, "test2"));
        userList.add(new User(3, "test3"));
        userList.add(new User(4, "test4"));
        userList.add(new User(5, "test5"));
        userList.add(new User(6, "test6"));
        userList.add(new User(7, "test7"));
        userList.add(new User(8, "test8"));

        PoiXlsxService poiXlsx = new PoiXlsxService();
        File xlsx = poiXlsx.userListToFile(userList);
        PoiXlsService poiXls = new PoiXlsService();
        File xls = poiXls.userListToFile(userList);

        userList = poiXlsx.fileToList(xlsx);
        System.out.println(Arrays.toString(userList.toArray()));
        userList = poiXls.fileToList(xls);
        System.out.println(Arrays.toString(userList.toArray()));
    }
}
